home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / boostrs.arc / CBLKHEAP.ASM < prev    next >
Assembly Source File  |  1985-10-18  |  2KB  |  96 lines

  1. ;*****************************************************
  2. ;
  3. ;       Procedure CblkHeap ( Page : HeapBuf;
  4. ;                              X1 : ColumnType;
  5. ;                              Y1 : RowType;
  6. ;                              X2 : ColumnType;
  7. ;                              Y2 : RowType;
  8. ;                              X3 : ColumnType;
  9. ;                              Y3 : RowType );
  10. ;
  11. ;              offset 18,16,14,12,10,08,06,04  from BP
  12. ;
  13. ;       Copies block on page of heap from X1,Y1,X2,Y2
  14. ;                                    to X3,Y3
  15. ;*****************************************************
  16. CblkHeap proc    near
  17.         push    bp
  18.     mov    bp,sp
  19.     push    ds
  20. ;
  21. ;*** Get address of page on heap
  22. ;
  23.     mov    bx,[bp+18]
  24.     mov    ds,bx
  25.     mov    es,bx
  26.     mov    di,[bp+16]
  27.     mov    si,di
  28. ;
  29. ;*** Compute Source, Destination addresses for move
  30. ;
  31.     mov    bx,[bp+12]    ;  Y1
  32.         dec     bx              ;  (Y1-1)
  33.     mov    dx,bx        ;  Save in DX
  34.     mov    cl,7
  35.     shl    dx,cl        ;  (Y1-1) * 128
  36.     mov    cl,5
  37.     shl    bx,cl        ;  (Y1-1) *  32
  38.     add    bx,dx        ;  (Y1-1) * 160
  39.     mov    ax,[bp+14]    ;  X1 into AX
  40.     dec    ax        ;  (X1-1)
  41.     shl    ax,1        ;  2 * (X1-1)
  42.     add    bx,ax
  43.     add    si,bx
  44. ;
  45.     mov    bx,[bp+04]    ;  Y3 into BX
  46.         dec     bx              ;  (Y3-1)
  47.     mov    dx,bx        ;  Save in DX
  48.     mov    cl,7
  49.     shl    dx,cl        ;  (Y3-1) * 128
  50.     mov    cl,5
  51.     shl    bx,cl        ;  (Y3-1) *  32
  52.     add    bx,dx        ;  (Y3-1) * 160
  53.     mov    ax,[bp+06]    ;  X3 into AX
  54.     dec    ax        ;  (X3-1)
  55.     shl    ax,1        ;  2 * (X3-1)
  56.     add    bx,ax
  57.     add    di,bx
  58. ;
  59. ;
  60. ;*** Compute number of lines to move
  61. ;
  62.     mov    ax,[bp+12]    ; value of Y1 into AX
  63.     mov    dx,[bp+08]    ; value of Y2 into DX
  64.         sub     dx,ax           ; DX = DX - AX
  65.     inc    dx        ; DX = Number of lines
  66. ;
  67. ;
  68. ;*** Compute length of each move
  69. ;
  70.     mov    ax,[bp+14]    ;  X1 into AX
  71.     mov    cx,[bp+10]    ;  X2 into CX
  72.     sub    cx,ax        ;  CX = X1 - X2
  73.     inc    cx
  74. ;
  75. ;*** Move block
  76. ;
  77.     mov    bx,cx
  78.     shl    bx,1
  79.     mov    ax,160
  80.     sub    ax,bx
  81. MOVER:    push    cx
  82.         cld
  83. rep    movsw
  84.     pop    cx
  85.     dec    dx
  86.     jz    DONE
  87.     add    si,ax
  88.     add    di,ax
  89.     jmp    MOVER
  90. ;
  91. DONE:   pop     ds
  92.         mov     sp,bp
  93.         pop     bp
  94.     ret    16
  95. CblkHeap endp
  96.